﻿using System.ComponentModel;
using System.Xml.Serialization;

namespace SecurityParser
{
    public abstract class DeployableItem
    {
        public enum DeploymentModes
        {
            Both = 0,
            DebugOnly = 1,
            NonDebugOnly = 2
        }

        [XmlAttribute("deploymentmode")]
        [DefaultValue(0)]
        public DeploymentModes DeploymentMode
        {
            get;
            set;
        }

        internal bool ShouldDeploy()
        {
            if (DeploymentMode == DeploymentModes.Both || DeploymentMode == DeploymentModes.NonDebugOnly)
            {
                return true;
            }
#if DEBUG
            if (DeploymentMode == DeploymentModes.DebugOnly)
            {
                return true;
            }
#endif
            return false;
        }
    }
}
